import { service as request } from '@/utils/request'

/**
 * 多条件分页查询
 * @param {*} data 
 * @returns 
 */
export function getList (data) {
  return request({
    url: `/hawk/cabinet/search/${data.page.current}/${data.page.size}`,
    method: 'post',
    data: data.query
  })
}

export function getAll () {
  return request({
    url: `/hawk/cabinet/search/1/10000`,
    method: 'post',
    data: { name: "", compayid: "", departmentid: "", computerroomid: "" }
  })
}

// 7.2
export function isNameExists (data) {
  return request({
    url: `/hawk/cabinet/exists/${data.companyId}/${data.deptId}/${data.roomId}`,
    method: 'get',
    params: { name: data.name }
  })
}



/**
 * 
 * @param {*} data 
 * @returns 
 */
export function doAdd (data) {
  return request({
    url: '/hawk/cabinet/save',
    method: 'post',
    data
  })
}
/**
 * 
 * @param {*} data 
 * @returns 
 */
export function doEdit (data) {
  return request({
    url: '/hawk/cabinet/update',
    method: 'put',
    data
  })
}
/**
 * 
 * @param {*} id 
 * @returns 
 */
export function doDelete (ids) {
  return request({
    url: `/hawk/cabinet/del`,
    method: 'delete',
    data: ids

  })
}
export function getOne (id) {
  return request({
    url: `/assets/list/cabinet/${id}`,
    method: 'get'
  })
}

export function getDepartmentList () {
  return request({
    url: 'company/department',
    method: 'get'
  })
}
export function getPrincipalList () {
  return request({
    url: 'assets/principal',
    method: 'get'
  })
}
